/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "SUB_DEPENDENCIA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SubDependencia.findAll", query = "SELECT s FROM SubDependencia s"),
    @NamedQuery(name = "SubDependencia.findBySubdCod", query = "SELECT s FROM SubDependencia s WHERE s.subdCod = :subdCod"),
    @NamedQuery(name = "SubDependencia.findBySubdNom", query = "SELECT s FROM SubDependencia s WHERE s.subdNom = :subdNom"),
    @NamedQuery(name = "SubDependencia.findBySubdTel", query = "SELECT s FROM SubDependencia s WHERE s.subdTel = :subdTel"),
    @NamedQuery(name = "SubDependencia.findBySubdMail", query = "SELECT s FROM SubDependencia s WHERE s.subdMail = :subdMail"),
    @NamedQuery(name = "SubDependencia.findBySubdFac", query = "SELECT s FROM SubDependencia s WHERE s.subdFac = :subdFac")})
public class SubDependencia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "SUBD_COD")
    private Integer subdCod;
    @Basic(optional = false)
    @Column(name = "SUBD_NOM")
    private String subdNom;
    @Column(name = "SUBD_TEL")
    private String subdTel;
    @Column(name = "SUBD_MAIL")
    private String subdMail;
    @Column(name = "SUBD_FAC")
    private String subdFac;
    @JoinColumn(name = "DEP_COD", referencedColumnName = "DEP_COD")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Dependencia depCod;
    @OneToMany(mappedBy = "subdCod", fetch = FetchType.LAZY)
    private List<Alumno> alumnoList;

    public SubDependencia() {
    }

    public SubDependencia(Integer subdCod) {
        this.subdCod = subdCod;
    }

    public SubDependencia(Integer subdCod, String subdNom) {
        this.subdCod = subdCod;
        this.subdNom = subdNom;
    }

    public Integer getSubdCod() {
        return subdCod;
    }

    public void setSubdCod(Integer subdCod) {
        this.subdCod = subdCod;
    }

    public String getSubdNom() {
        return subdNom;
    }

    public void setSubdNom(String subdNom) {
        this.subdNom = subdNom;
    }

    public String getSubdTel() {
        return subdTel;
    }

    public void setSubdTel(String subdTel) {
        this.subdTel = subdTel;
    }

    public String getSubdMail() {
        return subdMail;
    }

    public void setSubdMail(String subdMail) {
        this.subdMail = subdMail;
    }

    public String getSubdFac() {
        return subdFac;
    }

    public void setSubdFac(String subdFac) {
        this.subdFac = subdFac;
    }

    public Dependencia getDepCod() {
        return depCod;
    }

    public void setDepCod(Dependencia depCod) {
        this.depCod = depCod;
    }

    @XmlTransient
    public List<Alumno> getAlumnoList() {
        return alumnoList;
    }

    public void setAlumnoList(List<Alumno> alumnoList) {
        this.alumnoList = alumnoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (subdCod != null ? subdCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SubDependencia)) {
            return false;
        }
        SubDependencia other = (SubDependencia) object;
        if ((this.subdCod == null && other.subdCod != null) || (this.subdCod != null && !this.subdCod.equals(other.subdCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.SubDependencia[ subdCod=" + subdCod + " ]";
    }
    
}
